home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 12996 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.0 KB

  1. Path: user2.mnsinc.com!huang
  2. From: huang@mnsinc.com (Szu-Wen Huang)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Can anyone HELP with variable delaration? Please?
  5. Date: 3 Apr 1996 21:23:48 GMT
  6. Organization: Monumental Network Systems
  7. Message-ID: <4juq94$s35@news1.mnsinc.com>
  8. References: <4jt07b$dul@news.us.net> <3162119a.43634755@news.ucs.ubc.ca> <4juf2kINNe9v@keats.ugrad.cs.ubc.ca> <3162de71.18703379@news.ucs.ubc.ca>
  9. NNTP-Posting-Host: user2.mnsinc.com
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. James Fairweather (jamesdf@unixg.ubc.ca) wrote:
  13. : >Any variable can be declared constant, including strings:
  14.  
  15. : >    const char * const str = "Foo";
  16.  
  17. : >Or do you mean literal constants?
  18.  
  19. : I'm not sure what the difference is.  I thought the keyword "const"
  20. : was just for the compiler.  If you tried to modify the variable
  21. : declared const, the compiler would complain.  Does it do something
  22. : else with the variable if you declare it const?
  23.  
  24. Under an appropriate OS, the data would be placed in a read-only portion
  25. of memory so that you can't write to the data even by aliasing.
  26.